package com.leeon.container.example.foreach;

import java.util.Iterator;

public class RandomShapeGenerator implements Iterable<String> {

    private String[] names = ("I anm teacher").split(" ");

    @Override
    public Iterator iterator() {
        return null;
        /*
                new Iterator() {

            private int index = 0;

            @Override
            public boolean hasNext() {
                return index < names.length;
            }

            @Override
            public Object next() {
                return names[index++];
            }
        };
        */
    }

    public static void main(String[] args){
        RandomShapeGenerator r = new RandomShapeGenerator();
        Iterator<String> it = r.iterator();
        while (it.hasNext()){
            System.out.print(it.next() + " ");
        }
    }
}
